package com.mb.demo.service.impl;/*
 @author mabin
 @DESCRIPTION 
 @create 2023-5-19
*/

import com.mb.demo.entity.User;
import com.mb.demo.mapper.UserMapper;
import com.mb.demo.service.UserService;
import com.mb.demo.vo.UserVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Resource
    private UserMapper userMapper;
    @Override
    public List<User> getAll() {
        return userMapper.selectList(null);
    }

    @Override
    public User getById(String id) {
        return userMapper.selectById(id);
    }

    @Override
    public void saveUser(UserVo userVo) {
        User user = new User();
        BeanUtils.copyProperties(userVo,user);
        userMapper.insert(user);
    }


}
